﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace z.m.db {

	[MetadataType(typeof(Metadata.MMessenger))]
	public partial class Messenger { }

	[MetadataType(typeof(Metadata.MOccasion))]
	public partial class Occasion { }

	[MetadataType(typeof(Metadata.MOccasion_Detail))]
	public partial class Occasion_Detail { }

	[MetadataType(typeof(Metadata.MOccasion_Messenger))]
	public partial class Occasion_Messenger { }

	[MetadataType(typeof(Metadata.MOrder_Detail))]
	public partial class Order_Detail { }

	[MetadataType(typeof(Metadata.MOrder))]
	public partial class Order { }

	[MetadataType(typeof(Metadata.MProduct))]
	public partial class Product { }

	[MetadataType(typeof(Metadata.MUserProfile))]
	public partial class UserProfile {
		public int CurrentRole {
			get {
				if (webpages_Roles.Count() > 0) {
					return webpages_Roles.First().RoleId;
				} else {
					return 0;
				}
			}
			set {
				if (webpages_Roles.Count() > 0) {
					webpages_Roles.Remove(webpages_Roles.First());
				}
				if (value != 0) {
					webpages_Roles.Add(Controllers.App.db.webpages_Roles.Where(x => x.RoleId == value).Single());
				}
			}
		}
	}

	[MetadataType(typeof(Metadata.Mwebpages_Roles))]
	public partial class webpages_Roles { }
}